package com.example.demo.study.string;

public class StringService {
    public static void main(String[] args) throws InterruptedException {
        String i="Hello,my world!";
        char a=i.charAt(0);
        int index=i.indexOf("H");
        System.out.println(a);
        System.out.println(index);
        String r= i.substring(0,5);
        System.out.println(r);
        String t1=r.toLowerCase();
        String t2=r.toUpperCase();
        System.out.println(t1);
        System.out.println(t2);
        System.out.println(i.contains("my"));

        //StringBuilder t=new StringBuilder();
//        StringBuffer t=new StringBuffer();
//        ExecutorService executor= Executors.newFixedThreadPool(10);
//        for(int i=0;i<1000;i++)
//        {
//            executor.submit(()->{
//                t.append("a");
//            });
//        }
//        System.out.println("获取字符串长度:"+t.length());
//        executor.shutdown();
//        while (!executor.isTerminated())
//        {
//            Thread.sleep(1000);
//        }
//        System.out.println("获取字符串长度:"+t.length());

//         final  int t=0;
//        ExecutorService executor= Executors.newFixedThreadPool(10);
//        for(int i=0;i<1000;i++)
//        {
//            executor.submit(()->{
//                s=t+1;
//            });
//        }

//        System.out.println("获取字符串长度:"+t.length());
//        executor.shutdown();
//        while (!executor.isTerminated())
//        {
//            Thread.sleep(1000);
//        }
//        System.out.println("获取字符串长度:"+t.length());


    }
}
